package com.fxp.project.jiuselu.web.business.v1.controller.official;

import com.fxp.project.jiuselu.web.base.controller.BaseController;
import com.fxp.project.jiuselu.web.domain.CommonResult;
import com.fxp.project.jiuselu.web.models.official.entity.JslOfficial;
import com.fxp.project.jiuselu.web.models.official.service.JslOfficialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@RequestMapping("/v1/official")
public class JslOfficialController extends BaseController {
    @Autowired
    private JslOfficialService jslOfficialService;

    @PostMapping("/list")
    @CrossOrigin
    public CommonResult list(HttpServletResponse response){
        response.setHeader("Access-Control-Allow-Origin", "*");
        List<JslOfficial> jslOfficials = jslOfficialService.selectJslOfficial();
        return CommonResult.success(jslOfficials);
    }
}
